using System;
using System.Text;
using System.Collections;

namespace PersistenceObject.Framework.Expressions
{
    public class Expressions
    {
        private Expressions() { }

        public static Expression Equals(string name, object value)
        {
            return new EqualsExpression(name, value);
        }

        public static Expression NotEquals(string name, object value)
        {
            return new NotEqualsExpression(name, value);
        }

        public static Expression LessThan(string name, object value)
        {
            return new LessThanExpression(name, value);
        }

        public static Expression LessThanOrEquals(string name, object value)
        {
            return new LessThanOrEqualsExpression(name, value);
        }

        public static Expression GreaterThan(string name, object value)
        {
            return new GreaterThanExpression(name, value);
        }

        public static Expression GreaterThanOrEquals(string name, object value)
        {
            return new GreaterThanOrEqualsExpression(name, value);
        }

        public static Expression Like(string name, object value)
        {
            return new LikeExpression(name, value);
        }

        public static Expression In(string name, IList values)
        {
            return Expressions.In(name, values, false);
        }

        public static Expression In(string name, IList values, bool isNotIn)
        {
            InExpression expression = new InExpression(name, values);
            expression.IsNotIn = isNotIn;
            return expression;
        }

        public static Expression Expression()
        {
            return new Expression();
        }

        public static Expression Between(string name, object lvalue, object rvalue)
        {
            return Expressions.Between(name, lvalue, rvalue, false);
        }

        public static Expression Between(string name, object lvalue, object rvalue, bool isNotBetween)
        {
            BetweenExpression expression = new BetweenExpression(name, lvalue, rvalue);
            expression.IsNotBetween = isNotBetween;
            return expression;
        }
    }
}
